import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.*;

import java.util.stream.Stream;

public class JunitTest02 {
    public static Stream<Arguments> Generator() {
        return Stream.of(
                Arguments.arguments(1, "张三"),
                Arguments.arguments(2, "李四")
        );
    }

    @ParameterizedTest
    @ValueSource(ints = {1})
    void Test01(int num) {
        System.out.println(num);
        // Assertions.assertEquals(1, num);
        // Assertions.assertNotEquals(1, num);

//        String  s = "null1";
//        Assertions.assertNull(s);
    }

    @ParameterizedTest
    @CsvSource({"1, 2, 3, ''"})
    void Test02(String x, String y, int z, String s) {
        System.out.println(x);
        System.out.println(y);
        System.out.println(z);
        System.out.println(s);
        System.out.println("==============");
    }

    @ParameterizedTest
    @CsvFileSource(resources = "test02.csv")
    void test03(int num, String name) {
        System.out.println("学号: " + num + ", 姓名: " + name);
    }

    @ParameterizedTest
    @MethodSource("Generator")
    void test04(int num, String name) {
        System.out.println(num + ": " + name);
    }
}
